#!/bin/sh

echo "build menu, please select your choice:"
echo "  1   make clean"
echo "  2   build for EPC_28xA"
echo "  3   build for EPC_283B"
echo "  4   build for EPC_287B"
echo "  5   build for EPC_280"
echo "  6   build for IoT_3960"
echo "  7   build for IoT_3962"
echo "  8   build for A287_W128LI"
echo "  9   build for A287_WB128LI"
echo "  q   exit"

make_distclean() {
    echo "make distclean"
    make clean
}

config_EPC_28xA() {
	echo "EPC_28xA"
    cp .config .config.bk
    cp  arch/arm/configs/EPC_28xA_defconfig .config 
    make uImage
    cp .config.bk .config
}
config_EPC_283B() {
	echo "EPC_283B"
    cp .config .config.bk
    cp  arch/arm/configs/EPC_283B_defconfig .config 
    make uImage
    cp .config.bk .config
}
config_EPC_287B() {
	echo "EPC_287B"
    cp .config .config.bk
    cp  arch/arm/configs/EPC_287B_defconfig .config 
    make uImage
    cp .config.bk .config
}
config_EPC_280() {
	echo "EPC_280"
    cp .config .config.bk
    cp  arch/arm/configs/EPC_280_defconfig .config 
    make uImage
    cp .config.bk .config
}
config_IoT_3960() {
	echo "IoT_3960"
    cp .config .config.bk
    cp  arch/arm/configs/IoT_3960_defconfig .config 
    make uImage
    cp .config.bk .config
}
config_IoT_3962() {
	echo "IoT_3962"
    cp .config .config.bk
    cp  arch/arm/configs/IoT_3962_defconfig .config 
    make uImage
    cp .config.bk .config
}
config_A287_W128LI() {
	echo "A287_W128LI"
    cp .config .config.bk
    cp  arch/arm/configs/A287_W128LI_defconfig .config 
    make uImage
    cp .config.bk .config
}
config_A287_WB128LI() {
	echo "A287_WB128LI"
    cp .config .config.bk
    cp  arch/arm/configs/A287_WB128LI_defconfig .config 
    make uImage
    cp .config.bk .config
}

read sel
echo "select $sel"

case $sel in
    [1]) make_distclean;;
    [2]) config_EPC_28xA;;
    [3]) config_EPC_283B;;
    [4]) config_EPC_287B;;
    [5]) config_EPC_280;;
    [6]) config_IoT_3960;;
    [7]) config_IoT_3962;;
    [8]) config_A287_W128LI;;
    [9]) config_A287_WB128LI;;
    [q] | [Q]) exit 0;;
    *)   echo "ONLY accept 1~9/q/Q"
esac    
